/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 30318
 * Date: 2023-12-12
 * Time: 19:26
 */
public class Book {
    String title;          //图书名称
    String author;       //作者
    boolean borrowed;    //图书状态，初始状态为可用
    //使用给定的图书名称，创建一个新的Book对象 ，并置该对象的初始状态为可用
    public Book(String bookTitle,String author){
        // Implement this method
        this.title = bookTitle;
        this.author = author;
        this.borrowed = false;
    }
    // 借书，标记该书为借出状态
    public void borrowed() {
        // Implement this method
        this.borrowed = true;

    }
    //还书，标记该书为可用状态
    public void returned() {
        // Implement this method
        this.borrowed = false;
    }
    // Returns true if the book is rented, false otherwise
    public boolean isBorrowed() {
        // Implement this method
        if(borrowed)
            return true;
        else
            return false;
    }
    // Returns true if the book is available, false otherwise
    public Boolean isAvailable(){
        // Implement this method
        if(!borrowed)
            return true;
        else
            return false;
    }
    //返回图书的名称
    public String getTitle() {
        // Implement this method
        return title;
    }
    public String getAuthor() {
        return author;
    }
    public static void main(String[] arguments){
        Book example = new Book("Java程序设计教程","丁一");
        example.borrowed();
        System.out.println("图书名称：" + example.getTitle());
        System.out.println("图书作者：" + example.getAuthor());
        System.out.println("出租状态：" +( example.isBorrowed()?"出租中":"未出租"));
        System.out.println("可用状态：" + (example. isAvailable()?"可用":"不可用"));
    }
}